package mysql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class DeleteTable {
	static String deletetablesql =  "drop table time";
	public static void main(String[] args)
	{
	     try {
	          Class.forName("com.mysql.cj.jdbc.Driver");     //加载MYSQL JDBC驱动程序   
	          //Class.forName("org.gjt.mm.mysql.Driver");
	         System.out.println("Success loading Mysql Driver!");
	        }
	        catch (Exception e) {
	          System.out.print("Error loading Mysql Driver!");
	          e.printStackTrace();
	        }
	     try {
	       Connection connect = DriverManager.getConnection(
	              "jdbc:mysql://172.16.63.135/test","root","000000");
	       Statement statement=connect.createStatement();
	       
	       if(!statement.execute(deletetablesql))
	         {
	             System.out.println("成功删除表！");
	         }
	         else
	         {
	             System.out.println("删除表失败！");
	         }
	         //
	       statement.close();
	          connect.close();
	       
	       
	  } 
	     
	     catch(SQLException e)
		   {
	    	 e.printStackTrace();
	    	 System.out.println("删除表失败！");
		   }
	 }

}
